package com.itheima.mapper;

import com.itheima.vo.EmpJobDataVo;
import com.itheima.vo.ReporetVo;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface ReportMapper {

    //@Select("select gender name,count(gender) value from emp group by gender")
    @Select("select if(gender=1,'男性员工', '女性员工') AS name, count(*) AS value from emp group by gender")
    List<ReporetVo> count();

    //@Select("select if(job=1,'班主任',if(job=2,'讲师',if(job=3,'学工主管',if(job=4,'教研主管',if(job=5,'咨询师','其他'))))) as jobList,count(*) as dataList from emp group by job")
    List<ReporetVo> jobdata();

    @MapKey("name")
    List<Map> studentdegree();

    /**
     * 统计班级人数
     */
    @Select("select c.name cname , count(s.id) scount from clazz c  left join student s on s.clazz_id = c.id group by c.name order by count(s.id) desc ")
    List<Map> getStudentCount();
}
